﻿CREATE TABLE [dbo].[Message] (
    [Id]       UNIQUEIDENTIFIER NOT NULL,
    [UserId]   UNIQUEIDENTIFIER NOT NULL,
    [Subject]  NVARCHAR (30)    NOT NULL,
    [Content]  NVARCHAR (500)   NOT NULL,
    [CreateAt] DATETIME2 (3)    NOT NULL,
    [Status]   INT              NOT NULL,
    [ReplyId]  UNIQUEIDENTIFIER NULL,
    CONSTRAINT [PK_Message] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_Message_Message] FOREIGN KEY ([ReplyId]) REFERENCES [dbo].[Message] ([Id]),
    CONSTRAINT [FK_Message_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
);



